package action.ManagerAction;

import com.alibaba.fastjson.JSON;
import com.opensymphony.xwork2.ActionSupport;
import common.FtpUtils;
import common.Pagination;
import common.StringUtils;
import entity.CroPurgoods;
import entity.SysDict;
import jodd.io.FileUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.struts2.ServletActionContext;
import org.springframework.beans.factory.annotation.Autowired;
import service.CroPurgoodsService;
import service.SysDictService;
import vo.*;

import javax.servlet.ServletContext;
import java.io.File;
import java.util.*;

/**
 * Created by wsx on 2017/5/10.
 */
public class PurgoodsAction extends ActionSupport {

    private List<CroPurgoodsVo> croPurgoodsVos;
    private CroPurgoodsVo croPurgoodsVo;
    private CroPurgoodsVo recCroPurgoodsVo;
    private int flag;
    private String id;
    private String querygoodsname;
    private String price_min;
    private String price_max;
    private String querytype;
    private String type;
    private String goodname;
    private String imgurl;
    private String goodnumber;
    private String detail;
    private Date overdate;
    private Date createdate;
    private String price;
    private String goodsid;
    private String successResult;
    private String massage;//标记是否可以添加商品
    private int pageIndex;
    private int pageCount;
    private int pageSize = 10;
    private Map condition;
    private int queryflag;//查询的标记
    private String jsonObject;
    private String[] index;
    private String[] updateflag;
    private String[] updatevalue;
    private String mealtype;
    private String colortype;
    private String addgoodstype;
    private File upload;


    @Autowired
    private CroPurgoodsService croPurgoodsService;
    @Autowired
    private SysDictService sysDictService;

    /*
    * 获取全部商品
    * **/
    @RequiresPermissions("user:select")
    public String getPurgoodsList() {
        System.out.println("listaction");
        Pagination<CroPurgoodsVo> page = new Pagination<CroPurgoodsVo>();
        if (pageIndex == 0) {
            page = croPurgoodsService.listsPage(1, pageSize);
        } else {
            page = croPurgoodsService.listsPage(pageIndex, pageSize);
        }
        this.pageCount = (int) page.getPagesCount();
        this.pageIndex = (int) page.getCurIndex();
        this.croPurgoodsVos = page.getItems();


        for (int i = 0; i < croPurgoodsVos.size(); i++) {
            System.out.println("商品名字:" + croPurgoodsVos.get(i).getGoodname());
            String json = croPurgoodsVos.get(i).getDescription();
            CroPurgoodsVos goods = new CroPurgoodsVos();
            goods = JSON.parseObject(json, CroPurgoodsVos.class);
            List<GoodsShowSkuItemsVo> goodsShowSkuItemsVoList = goods.getGoodsShowSkuItems();
            StringBuffer sb = new StringBuffer();
            for (GoodsShowSkuItemsVo goodsShowSkuItemsVo : goodsShowSkuItemsVoList) {
                sb.append(goodsShowSkuItemsVo.getPropName() + ":");
                if (!(goodsShowSkuItemsVo.equals(null))) {
                    for (PropertyAliasListVo propertyAliasListVo : goodsShowSkuItemsVo.getPropertyAliasList()) {
                        sb.append(propertyAliasListVo.getCustomName() + ";");
                    }
                }
                sb.append("    ");
            }
            croPurgoodsVos.get(i).setDetail(sb.toString());
            croPurgoodsVos.get(i).setImagurl(goods.getPicUrl());

        }
        return SUCCESS;
    }

    /*
 * 查询商品
 * **/
    @RequiresPermissions("user:select")
    public String queryPurgoodsbyCondiction() {
        croPurgoodsVo = new CroPurgoodsVo();
        System.out.println("queryaction" + croPurgoodsVo.getGoodname() + "price_min:" + croPurgoodsVo.getPrice_min() + "price_max:" + croPurgoodsVo.getPrice_max());
        //croPurgoodsVos=croPurgoodsService.getPurgoodsByCondiction(querygoodsname,querytype,price_min,price_max);
        Pagination<CroPurgoodsVo> page = new Pagination<CroPurgoodsVo>();
        if (pageIndex == 0) {
            page = croPurgoodsService.listsPageByConditcion(1, pageSize, querygoodsname, querytype, price_min, price_max);
        } else {
            page = croPurgoodsService.listsPageByConditcion(pageIndex, pageSize, querygoodsname, querytype, price_min, price_max);
        }
        this.pageCount = (int) page.getPagesCount();
        this.pageIndex = (int) page.getCurIndex();
        this.croPurgoodsVos = page.getItems();
        CroPurgoodsVo temp = new CroPurgoodsVo();
        temp.setType(querytype);
        temp.setGoodname(querygoodsname);
        temp.setPrice_min(price_min);
        temp.setPrice_max(price_max);
        setRecCroPurgoodsVo(temp);
        for (int i = 0; i < croPurgoodsVos.size(); i++) {
            System.out.println("商品名字:" + croPurgoodsVos.get(i).getGoodname());
            String json = croPurgoodsVos.get(i).getDescription();
            CroPurgoodsVos goods = new CroPurgoodsVos();
            goods = JSON.parseObject(json, CroPurgoodsVos.class);
            List<GoodsShowSkuItemsVo> goodsShowSkuItemsVoList = goods.getGoodsShowSkuItems();
            StringBuffer sb = new StringBuffer();
            for (GoodsShowSkuItemsVo goodsShowSkuItemsVo : goodsShowSkuItemsVoList) {
                sb.append(goodsShowSkuItemsVo.getPropName() + ":");
                for (PropertyAliasListVo propertyAliasListVo : goodsShowSkuItemsVo.getPropertyAliasList()) {
                    sb.append(propertyAliasListVo.getCustomName() + ";");
                }
                sb.append("    ");
            }
            croPurgoodsVos.get(i).setDetail(sb.toString());
            croPurgoodsVos.get(i).setImagurl(goods.getPicUrl());
        }
        jsonObject = JSON.toJSONString(recCroPurgoodsVo);
        return SUCCESS;
    }

    /*
 * 删除商品
 * **/
    @RequiresPermissions("user:delete")
    public String deletPurgood() {
        System.out.println("deletePurgoodAction,goodsid" + goodsid);
        if (croPurgoodsService.deletePurgoods(goodsid)) {
            successResult = "删除成功！";
        } else {
            successResult = "删除失败！";
        }
        return SUCCESS;
    }

    /*
* 获取修改商品页的信息
* **/
    @RequiresPermissions("user:select")
    public String getUpdategoodsInfo() {
        System.out.println("getupdategoodsinfoaction" + goodsid);
        croPurgoodsVo = croPurgoodsService.getUpdateGoodsInfo(goodsid);
        String json = croPurgoodsVo.getDescription();
        CroPurgoodsVos goods = new CroPurgoodsVos();
        goods = JSON.parseObject(json, CroPurgoodsVos.class);
        Map<String, Map> map = new HashMap<String, Map>();
        List<GoodsShowSkuItemsVo> goodsShowSkuItemsVoList = goods.getGoodsShowSkuItems();
        System.out.println("goodsShowSkuItemsVoList.size" + goodsShowSkuItemsVoList.size());
        for (GoodsShowSkuItemsVo goodsShowSkuItemsVo : goodsShowSkuItemsVoList) {
            Map tempmap = new HashMap();
            for (PropertyAliasListVo propertyAliasListVo : goodsShowSkuItemsVo.getPropertyAliasList()) {
                tempmap.put(propertyAliasListVo.getPropValueId(), propertyAliasListVo.getCustomName());
                System.out.println("值：" + propertyAliasListVo.getPropId());
            }
            System.out.println("map.size" + tempmap.size());
            map.put(goodsShowSkuItemsVo.getPropName(), tempmap);
        }
        croPurgoodsVo.setMaps(map);
        croPurgoodsVo.setImagurl(goods.getPicUrl());
        return SUCCESS;
    }

    /*
 * 添加商品
 * **/
    @RequiresPermissions("user:write")
    public String addPurgoods() {
        System.out.println("file:"+upload);
        String base = "abcdefghijklmnopqrstuvwxyz0123456789";
        Random random = new Random();
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < 20; i++) {
            int number = random.nextInt(base.length());
            sb.append(base.charAt(number));
        }
       String path=sb.toString()+".jpg";
        try{
            FtpUtils.upload(null, "bxu2359600628.my3w.com", "bxu2359600628", 21, "xingxing8", "/htdocs",upload,path);
        }catch (Exception e){
            System.out.println("上传失败！");
        }
        this.imgurl="http://bxu2359600628.my3w.com/"+path;
        massage = "yes";
        System.out.println("addPurgoodsAction"+"imgurl:"+imgurl);
        CroPurgoods croPurgoods = new CroPurgoods();

        //封装json
        CroPurgoodsVos croPurgoodsjsonVos = new CroPurgoodsVos();
        croPurgoodsjsonVos.setTitle(goodname);
        croPurgoodsjsonVos.setPrice(Double.parseDouble(price));
        croPurgoodsjsonVos.setPicUrl(imgurl);
        GoodsPropertiesNameVo goodsPropertiesNameVo = new GoodsPropertiesNameVo();
        String randnumber = String.valueOf((int) (Math.random() * 9 + 1) * 1000);
        String randnumber2 = String.valueOf((int) (Math.random() * 9 + 1) * 1000);
        String randnumber3 = String.valueOf((int) (Math.random() * 9 + 1) * 1000);
        String randnumber4 = String.valueOf((int) (Math.random() * 9 + 1) * 1000);

        goodsPropertiesNameVo.setPropId(randnumber);
        goodsPropertiesNameVo.setPropName("套餐类型");
        goodsPropertiesNameVo.setPropValueId(randnumber2);
        goodsPropertiesNameVo.setPropValueName(mealtype);
        GoodsPropertiesNameVo goodsPropertiesNameVo2 = new GoodsPropertiesNameVo();
        goodsPropertiesNameVo2.setPropId(randnumber3);
        goodsPropertiesNameVo2.setPropName("颜色分类");
        goodsPropertiesNameVo2.setPropValueId(randnumber4);
        goodsPropertiesNameVo2.setPropValueName(colortype);
        List<GoodsPropertiesNameVo> list = new ArrayList();
        list.add(goodsPropertiesNameVo);
        list.add(goodsPropertiesNameVo2);

        SkusVo skusVo = new SkusVo();
        skusVo.setCreatedTime(new Date().toString());
        skusVo.setModifiedTime(new Date().toString());

        if (StringUtils.isNotBlank(price)) {
            skusVo.setPrice(0.0);
        } else {
            skusVo.setPrice(0.0);
        }
        skusVo.setQuantity(Integer.parseInt(goodnumber));
        skusVo.setPropertiesName(list);

        PropertyAliasListVo propertyAliasListVo = new PropertyAliasListVo();
        propertyAliasListVo.setPropId(randnumber);
        propertyAliasListVo.setPropValueId(randnumber2);
        propertyAliasListVo.setCustomName(mealtype);
        propertyAliasListVo.setBigImage(imgurl);
        propertyAliasListVo.setSmallImage(imgurl);

        PropertyAliasListVo propertyAliasListVo2 = new PropertyAliasListVo();
        propertyAliasListVo2.setPropId(randnumber3);
        propertyAliasListVo2.setPropValueId(randnumber4);
        propertyAliasListVo2.setCustomName(colortype);
        propertyAliasListVo2.setBigImage(imgurl);
        propertyAliasListVo2.setSmallImage(imgurl);
        List<PropertyAliasListVo> propertyAliasListVoList1 = new ArrayList<>();
        propertyAliasListVoList1.add(propertyAliasListVo);
        List<PropertyAliasListVo> propertyAliasListVoList2 = new ArrayList<>();
        propertyAliasListVoList2.add(propertyAliasListVo2);
        GoodsShowSkuItemsVo goodsShowSkuItemsVo = new GoodsShowSkuItemsVo();
        goodsShowSkuItemsVo.setPropName("套餐类型");
        goodsShowSkuItemsVo.setPropertyAliasList(propertyAliasListVoList1);
        GoodsShowSkuItemsVo goodsShowSkuItemsVo2 = new GoodsShowSkuItemsVo();
        goodsShowSkuItemsVo2.setPropName("颜色分类");
        goodsShowSkuItemsVo2.setPropertyAliasList(propertyAliasListVoList2);
        List<GoodsShowSkuItemsVo> goodsShowSkuItemsVoList = new ArrayList<>();
        goodsShowSkuItemsVoList.add(goodsShowSkuItemsVo);
        goodsShowSkuItemsVoList.add(goodsShowSkuItemsVo2);
        List<SkusVo> skusVoList = new ArrayList<>();
        skusVoList.add(skusVo);
        croPurgoodsjsonVos.setGoodsShowSkuItems(goodsShowSkuItemsVoList);
        croPurgoodsjsonVos.setSkus(skusVoList);


        croPurgoods.setOverdate(new Date());
        croPurgoods.setType(type);
        if (StringUtils.isNotBlank(price)) {
            croPurgoods.setUniprice(Double.parseDouble(price));
        }
        croPurgoods.setCreatetime(new Date());
        croPurgoods.setGoodname(goodname);
        croPurgoods.setHasgoods("0");
        croPurgoods.setGoodsnumber(goodnumber);
        croPurgoods.setDescription(JSON.toJSON(croPurgoodsjsonVos).toString());
        System.out.println("goodname:" + goodname);
        if (croPurgoodsService.addPurgoods(croPurgoods, type, goodname) == 0) {
            massage = "yes";
        } else {
            massage = "no";
        }
        return SUCCESS;
    }

    /*
    * 修改商品(不用)
    * */
    @RequiresPermissions("user:update")
    public String updatePurgoods() {
        System.out.println("updatePurgoodsAction" + "goodsid" + goodsid + "goodname:" + goodname + "createdate" + createdate);

        CroPurgoods croPurgoods = new CroPurgoods();
        PurgoodsDescriptionVo purgoodsDescriptionVo = new PurgoodsDescriptionVo();
        //把商品描述转成json
        purgoodsDescriptionVo.setCreatetime(createdate);
        if (StringUtils.isNotBlank(goodnumber)) {
            if (Double.parseDouble(goodnumber) < 0) {
                croPurgoods.setHasgoods("1");
            } else {
                croPurgoods.setHasgoods("0");
            }
        } else {
            croPurgoods.setHasgoods("1");
        }
        purgoodsDescriptionVo.setDetail(detail);
        purgoodsDescriptionVo.setGoodname(goodname);
        purgoodsDescriptionVo.setGoodsNumber(goodnumber);
        purgoodsDescriptionVo.setImgurl(imgurl);
        purgoodsDescriptionVo.setType(type);
        purgoodsDescriptionVo.setOverdate(overdate);
        purgoodsDescriptionVo.setUniprice(0);

        purgoodsDescriptionVo.setDel_flag("0");

        croPurgoods.setOverdate(overdate);
        croPurgoods.setType(type);
        if (StringUtils.isNotBlank(price)) {
            croPurgoods.setUniprice(Double.parseDouble(price));
        }
        croPurgoods.setCreatetime(createdate);
        croPurgoods.setId(goodsid);
        croPurgoods.setDescription(JSON.toJSON(purgoodsDescriptionVo).toString());
        croPurgoods.setGoodname(goodname);
        croPurgoods.setDel_flag("0");
        System.out.println("goodname:" + goodname);

        if (croPurgoodsService.updatePurgoods(croPurgoods)) {
            return SUCCESS;
        } else {
            return null;
        }

    }

    /*
    * 修改商品ss
    * */
    @RequiresPermissions("user:update")
    public String updategoods() {
        System.out.println("goodsid:" + goodsid);
        File file2=upload;

        if(FileUtil.isExistingFile(upload)) {
            String base = "abcdefghijklmnopqrstuvwxyz0123456789";
            Random random = new Random();
            StringBuffer sb = new StringBuffer();
            for (int i = 0; i < 20; i++) {
                int number = random.nextInt(base.length());
                sb.append(base.charAt(number));
            }
            String path = sb.toString() + ".jpg";
            try {
                FtpUtils.upload(null, "bxu2359600628.my3w.com", "bxu2359600628", 21, "xingxing8", "/htdocs", upload, path);
            } catch (Exception e) {
                System.out.println("上传失败！");
            }
            this.imgurl = "http://bxu2359600628.my3w.com/" + path;
        }
        for (int i = 0; i < updateflag.length; i++) {
            System.out.println(updateflag[i]);
            System.out.println(index[i]);
        }
        System.out.println("goodname" + goodname);
        croPurgoodsVo = croPurgoodsService.getUpdateGoodsInfo(goodsid);
        String json = croPurgoodsVo.getDescription();
        CroPurgoodsVos goods = new CroPurgoodsVos();
        goods = JSON.parseObject(json, CroPurgoodsVos.class);
        Map<String, Map> map = new HashMap<String, Map>();
        List<GoodsShowSkuItemsVo> goodsShowSkuItemsVoList = goods.getGoodsShowSkuItems();
        List<SkusVo> Skus = goods.getSkus();
        for (int i = 0; i < updateflag.length; i++) {
            GoodsShowSkuItemsVo goodsShowSkuItemsVo = goods.getGoodsShowSkuItems().get(Integer.parseInt(updateflag[i]) - 1);
            if (!(Integer.parseInt(index[i]) == -1)) {
//                for (PropertyAliasListVo propertyAliasListVo : goodsShowSkuItemsVo.getPropertyAliasList()) {
//                    if (propertyAliasListVo.getPropValueId().equals(index[i])) {
//                        propertyAliasListVo.setCustomName(updatevalue[i]);
//                    }
//                }
                for (GoodsShowSkuItemsVo goodsShowSkuItemsVo1 : goodsShowSkuItemsVoList) {
                    for (PropertyAliasListVo propertyAliasListVo : goodsShowSkuItemsVo1.getPropertyAliasList()) {
                        if (propertyAliasListVo.getPropValueId().equals(index[i])) {
                            propertyAliasListVo.setCustomName(updatevalue[i]);
                        }
                    }
                }
                for (SkusVo skusVo : Skus) {
                    for (GoodsPropertiesNameVo goodsPropertiesNameVo : skusVo.getPropertiesName()) {
                        if (goodsPropertiesNameVo.getPropValueId().equals(index[i])) {
                            goodsPropertiesNameVo.setPropValueName(updatevalue[i]);
                            System.out.println("测试：" + updatevalue[i]);
                        }
                    }
                }
            }
        }

        goods.setTitle(goodname);
        goods.setPrice(Double.parseDouble(price));
        goods.setPicUrl(imgurl);
        System.out.println("json:" + JSON.toJSON(goods).toString());
        System.out.println("test" + goodsShowSkuItemsVoList.get(0).getPropName());
        CroPurgoods croPurgoods = new CroPurgoods();
        croPurgoods.setId(croPurgoodsVo.getId());
        croPurgoods.setDel_flag("0");
        croPurgoods.setType(type);
        croPurgoods.setGoodname(goodname);
        croPurgoods.setDescription(JSON.toJSON(goods).toString());
        croPurgoods.setOverdate(new Date());
        croPurgoods.setUniprice(Double.parseDouble(price));
        croPurgoods.setCreatetime(croPurgoodsVo.getCreatetime());

        if (StringUtils.isNotBlank(goodnumber)) {
            croPurgoods.setHasgoods("0");
        }
        croPurgoods.setGoodsnumber(goodnumber);

        croPurgoodsService.updatePurgoods(croPurgoods);
        return SUCCESS;
    }

    /*
    * 添加，修改，删除商品类型
    * */
    @RequiresPermissions("user:write")
    public String addGoodsType() {
        System.out.println("add" + addgoodstype + "type:" + type + "flag:" + flag);
        if (flag==1) {
            SysDict sysDict = new SysDict();
            sysDict.setDel_flag("0");
            sysDict.setDescription("商品类型");
            sysDict.setLabel("goods_type");
            sysDict.setValue(addgoodstype);
            int num = 0;
            for (int i = 0; i < 4; i++) {
                num = (int) (Math.random() * 9000 + 1000);
            }
            sysDict.setType(String.valueOf(num));
            croPurgoodsService.addGoodsType(sysDict);
        } else {
            SysDict sysDict1 = croPurgoodsService.getSysDictinfo(type);
            System.out.println("test:" + sysDict1.getType());
            if (flag==2) {
                System.out.println(2);
                sysDict1.setValue(addgoodstype);
            } else if (flag==3) {
                System.out.println("3");
                sysDict1.setDel_flag("1");
            }
            croPurgoodsService.updateGoodstype(sysDict1);
        }
        ServletContext context = ServletActionContext.getServletContext();
        //刷新缓存
        List<SysDict> list = sysDictService.lists();
        Map<String, Map<String, String>> maps = new HashMap<String, Map<String, String>>();
        for (SysDict dict : list) {
            maps.computeIfAbsent(dict.getLabel(), k -> new HashMap<String, String>());
            maps.get(dict.getLabel()).put(dict.getType(), dict.getValue());
        }
        context.setAttribute("SysDict", maps);
        successResult = "0";
        return SUCCESS;
    }

    public String getAddgoodstype() {
        return addgoodstype;
    }

    public void setAddgoodstype(String addgoodstype) {
        this.addgoodstype = addgoodstype;
    }

    public List<CroPurgoodsVo> getCroPurgoodsVos() {
        return croPurgoodsVos;
    }

    public void setCroPurgoodsVos(List<CroPurgoodsVo> croPurgoodsVos) {
        this.croPurgoodsVos = croPurgoodsVos;
    }

    public String getQuerygoodsname() {
        return querygoodsname;
    }

    public void setQuerygoodsname(String querygoodsname) {
        this.querygoodsname = querygoodsname;
    }

    public String getPrice_min() {
        return price_min;
    }

    public void setPrice_min(String price_min) {
        this.price_min = price_min;
    }

    public String getPrice_max() {
        return price_max;
    }

    public void setPrice_max(String price_max) {
        this.price_max = price_max;
    }

    public String getQuerytype() {
        return querytype;
    }

    public void setQuerytype(String querytype) {
        this.querytype = querytype;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getGoodname() {
        return goodname;
    }

    public void setGoodname(String goodname) {
        this.goodname = goodname;
    }

    public String getImgurl() {
        return imgurl;
    }

    public void setImgurl(String imgurl) {
        this.imgurl = imgurl;
    }

    public String getGoodnumber() {
        return goodnumber;
    }

    public void setGoodnumber(String goodnumber) {
        this.goodnumber = goodnumber;
    }

    public String getDetail() {
        return detail;
    }

    public void setDetail(String detail) {
        this.detail = detail;
    }

    public Date getOverdate() {
        return overdate;
    }

    public void setOverdate(Date overdate) {
        this.overdate = overdate;
    }

    public String getPrice() {
        return price;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public String getGoodsid() {
        return goodsid;
    }

    public void setGoodsid(String goodsid) {
        this.goodsid = goodsid;
    }

    public String getSuccessResult() {
        return successResult;
    }

    public void setSuccessResult(String successResult) {
        this.successResult = successResult;
    }

    public Date getCreatedate() {
        return createdate;
    }

    public void setCreatedate(Date createdate) {
        this.createdate = createdate;
    }

    public String getMassage() {
        return massage;
    }

    public void setMassage(String massage) {
        this.massage = massage;
    }

    public int getPageIndex() {
        return pageIndex;
    }

    public void setPageIndex(int pageIndex) {
        this.pageIndex = pageIndex;
    }

    public int getPageCount() {
        return pageCount;
    }

    public void setPageCount(int pageCount) {
        this.pageCount = pageCount;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public Map getCondition() {
        return condition;
    }

    public void setCondition(Map condition) {
        this.condition = condition;
    }

    public int getQueryflag() {
        return queryflag;
    }

    public void setQueryflag(int queryflag) {
        this.queryflag = queryflag;
    }


    public CroPurgoodsVo getCroPurgoodsVo() {
        return croPurgoodsVo;
    }

    public void setCroPurgoodsVo(CroPurgoodsVo croPurgoodsVo) {
        this.croPurgoodsVo = croPurgoodsVo;
    }

    public String getJsonObject() {
        return jsonObject;
    }

    public void setJsonObject(String jsonObject) {
        this.jsonObject = jsonObject;
    }

    public CroPurgoodsVo getRecCroPurgoodsVo() {
        return recCroPurgoodsVo;
    }

    public void setRecCroPurgoodsVo(CroPurgoodsVo recCroPurgoodsVo) {
        this.recCroPurgoodsVo = recCroPurgoodsVo;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String[] getIndex() {
        return index;
    }

    public void setIndex(String[] index) {
        this.index = index;
    }

    public String[] getUpdateflag() {
        return updateflag;
    }

    public void setUpdateflag(String[] updateflag) {
        this.updateflag = updateflag;
    }

    public String[] getUpdatevalue() {
        return updatevalue;
    }

    public void setUpdatevalue(String[] updatevalue) {
        this.updatevalue = updatevalue;
    }

    public String getMealtype() {
        return mealtype;
    }

    public void setMealtype(String mealtype) {
        this.mealtype = mealtype;
    }

    public String getColortype() {
        return colortype;
    }

    public void setColortype(String colortype) {
        this.colortype = colortype;
    }

    public int getFlag() {
        return flag;
    }

    public void setFlag(int flag) {
        this.flag = flag;
    }

    public File getUpload() {
        return upload;
    }

    public void setUpload(File upload) {
        this.upload = upload;
    }
}
